﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.LeaveCommand;
using RBAC.MaHaiBo.Entity;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.LeaveHandler
{
    public class LeavedepartmentCommandHandler : IRequestHandler<LeavedepartmentCommand, List<UserInfo>>
    {
        /// <summary>
        /// 请假服务层
        /// </summary>
        ILeaveService lSer;
        public LeavedepartmentCommandHandler(ILeaveService lSer)
        {
            this.lSer = lSer;
        }

        public async Task<List<UserInfo>> Handle(LeavedepartmentCommand request, CancellationToken cancellationToken)
        {
            return await lSer.Getdepartment(request.department);
        }
    }
}
